package E2017;

class Student{
    private int sNO;
    private String sName;
    private char sSex;
    private int sAge;
    private int sJava;
    public Student(int sNO, String sName, char sSex, int sAge, int sJava) {
        this.sNO = sNO;
        this.sName = sName;
        this.sSex = sSex;
        this.sAge = sAge;
        this.sJava = sJava;
    }
    public int getsNO() {
        return sNO;
    }
    public void setsNO(int sNO) {
        this.sNO = sNO;
    }
    public String getsName() {
        return sName;
    }
    public void setsName(String sName) {
        this.sName = sName;
    }
    public char getsSex() {
        return sSex;
    }
    public void setsSex(char sSex) {
        this.sSex = sSex;
    }
    public int getsAge() {
        return sAge;
    }
    public void setsAge(int sAge) {
        this.sAge = sAge;
    }
    public int  getsJava() {
        return sJava;
    }
    public void setsJava(int sJava) {
        this.sJava = sJava;
    }
    public static void show(Student[] stu){
        System.out.println("-----------学员信息---------");
        for (int i=0;i<stu.length;i++){
            System.out.println(stu[i].getsNO()+"\t"+stu[i].getsName()+"\t"+stu[i].getsSex()+"\t"+stu[i].getsAge()+"\t"+stu[i].getsJava());
        }
    }

}

public class Exam1 {
    public static void main(String[] args) {

        Student[] stu = new Student[5];
        stu[0] = new Student(1,"jack",'男',20,98);
        stu[1] = new Student(2,"smith",'男',22,92);
        stu[2] = new Student(3,"jerry",'男',21,96);
        stu[3] = new Student(4,"alice",'男',20,94);
        stu[4] = new Student(5,"peter",'男',21,90);
        Student.show(stu);

        int[] a = new int[5];
        for (int i=0;i<stu.length;i++) {
            a[i] = stu[i].getsJava();
        }
        int max = 0;
        int min = 0;
        int sum = 0;
        int avg = 0;
        for(int i=0;i<a.length;i++){
            max = a[0];
            if (a[i]>max){
                max = a[i];
            }
        }
        for(int i=0;i<a.length;i++){
            min = a[0];
            if (a[i]<min){
                min = a[i];
            }
        }
        for (int i=0;i<5;i++){
            sum = sum+a[i];
        }
        avg = sum/a.length;
        System.out.println("最大："+max);
        System.out.println("最小:"+min);
        System.out.println("平均值:"+avg);

    }
}
